public class Main {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person();
        Person person2 = (Person) person1.clone();

        System.out.println(person1);
        System.out.println(person2);

        System.out.println(person1 == person2);
        System.out.println(person1.equals(person2));

        System.out.println(person1.toString());
    }


}

class Person implements Cloneable{
    Money money = new Money();
    int a = 10;
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof Person)){
            return false;
        }
        Person person = (Person) obj;

        return person.money == this.money;
    }
}

class Money {
    public double m = 99.99;


}